<template>
  <div class="userInfo">
    <el-dropdown>
      <span class="el-dropdown-link">
        {{ name }}
        <el-icon class="el-icon--right">
          <ArrowDown />
        </el-icon>
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item>退出登录</el-dropdown-item>

          <el-dropdown-item divided>用户信息</el-dropdown-item>
          <el-dropdown-item>系统管理</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { ArrowDown } from '@element-plus/icons-vue'
import { useStore } from 'vuex'

export default defineComponent({
  components: {
    ArrowDown
  },
  setup() {
    const store = useStore()
    const name = store.state.loginModule.userInfo.name

    return {
      name
    }
  }
})
</script>

<style scoped></style>
